﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GoogleReaderToDelicious.Core.DTO;
using GoogleReaderToDelicious.Core.Infrastructure;
using GoogleReaderToDelicious.Core.Model;

namespace GoogleReaderToDelicious.Core.Repositories
{
    //22-Nov-2011 Priyan R
    public class ExportRepository : RepositoryBase
    {
        public ExportRepository(DatabaseContext context)
            : base(context)
        {
        }
        public void DeleteAllNotes()
        {
            _context.ExecuteSqlCommand("DELETE FROM Bookmarks");
        }
        public BookMark GetBookMarkById(Guid id)
        {
            return _context.BookMarks.Where(p => p.Id == id).FirstOrDefault();
        }
        public BookMarkCountDetailsDTO GetBookMarkCountDetails()
        {
            var ret = new BookMarkCountDetailsDTO();
            ret.TotalCount = _context.BookMarks.Count();
            ret.ExportedCount = _context.BookMarks.Where(p => p.IsExported).Count();
            return ret;
        }
        public List<BookMark> GetBookMarksToExport()
        {
            return _context.BookMarks.Where(p => p.IsExported == false).ToList();
        }
    }
}
